home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / InsideBa1994 / InsideBasic-94 / IB 94 / Snow Flakes / Snow Flake
Text File  |  1990-08-09  |  2KB  |  98 lines

  1. WINDOW OFF
  2. COORDINATE WINDOW
  3. DIM T,L,B,R
  4. DIM ScrnT,ScrnL,ScrnB,ScrnR
  5. DIM SnowFlake(25,1)
  6. CALL GETWMGRPORT(WMgrPort&)
  7. BLOCKMOVE WMgrPort&+8,VARPTR(ScrnT),8
  8. T = 0:L = 0:B = 280:R = 200
  9. CALL OFFSETRECT(T,ScrnR/2-R/2,(ScrnB/2+8)-B/2)
  10. WINDOW 1,"",(L,T)-(R,B),4
  11. GrafPortRgn& = PEEK LONG(WINDOW(14)+24)
  12. ScratchRgn&  = FN NEWRGN
  13. WndFrmRgn&   = FN NEWRGN
  14. WPaneRgn&    = FN NEWRGN
  15. StoreRgn&    = FN NEWRGN
  16. CALL COPYRGN(GrafPortRgn&,StoreRgn&)
  17. GOSUB"Draw Frame"
  18.  
  19. T=0:L=0:B=WINDOW(3)-1:R=WINDOW(2)-1
  20. CALL INSETRECT(T,48,48)
  21. Wd=(R-L)/2-4:Ht=(B-T)/4-4
  22. L=L+2 : R=L+Wd
  23. T=T+2 : B=T+Ht
  24.  
  25. CALL RECTRGN(ScratchRgn&,T)
  26. GOSUB"Add Regions"
  27.  
  28. FOR X=1 TO 3
  29.   CALL OFFSETRECT(T,0,Ht+4)
  30.   CALL RECTRGN(ScratchRgn&,T)
  31.   GOSUB"Add Regions"
  32. NEXT
  33.  
  34. CALL ERASERGN(WndFrmRgn&)
  35. CALL FRAMERGN(WndFrmRgn&)
  36. CALL COPYRGN(WPaneRgn&,GrafPortRgn&)
  37. CALL INVERTRGN(GrafPortRgn&)
  38.  
  39. T=0:L=0:B=WINDOW(3)-1:R=WINDOW(2)-1
  40. CALL INSETRECT(T,50,50)
  41. PEN ,,,,19
  42. FOR Flake = 0 TO 25
  43.   SnowFlake(Flake,0)=RND(R-L)+L
  44.   SnowFlake(Flake,1)=RND(B-T)+T
  45.   PLOT SnowFlake(Flake,0),SnowFlake(Flake,1)
  46. NEXT
  47. DO
  48. FOR Flake = 0 TO 25
  49.   PEN,,,,19
  50.   PLOT SnowFlake(Flake,0),SnowFlake(Flake,1)+1
  51.   PEN,,,,0
  52.   PLOT SnowFlake(Flake,0),SnowFlake(Flake,1)
  53.   SnowFlake(Flake,1) = SnowFlake(Flake,1) + 1
  54.   LONG IF SnowFlake(Flake,1)>B
  55.     SnowFlake(Flake,0)=RND(R-L)+L
  56.     SnowFlake(Flake,1)=T
  57.   END IF
  58. NEXT
  59.  
  60.  
  61. UNTIL FN BUTTON OR LEN(INKEY$)
  62. CALL COPYRGN(StoreRgn&,GrafPortRgn&)
  63. CALL DISPOSERGN(ScratchRgn&)
  64. CALL DISPOSERGN(WPaneRgn&)
  65. CALL DISPOSERGN(WndFrmRgn&)
  66.  
  67. END
  68. "Add Regions"
  69. CALL UNIONRGN (ScratchRgn&,WndFrmRgn&,WndFrmRgn&)
  70. CALL INSETRGN (ScratchRgn&,1 , 1)
  71. CALL UNIONRGN (ScratchRgn&,WPaneRgn& ,WPaneRgn& )
  72. CALL INSETRGN (ScratchRgn&,-1,-1)
  73. CALL OFFSETRGN(ScratchRgn&,Wd+4,0)
  74. CALL UNIONRGN (ScratchRgn&,WndFrmRgn&,WndFrmRgn&)
  75. CALL INSETRGN (ScratchRgn&,1 , 1)
  76. CALL UNIONRGN (ScratchRgn&,WPaneRgn& ,WPaneRgn& )
  77. CALL INSETRGN (ScratchRgn&,-1,-1)
  78. RETURN
  79. "Draw Frame"
  80. PEN 1,1,1,8,28
  81. CALL PAINTRGN(GrafPortRgn&)
  82. CALL PENNORMAL
  83. T=0:L=0:B=WINDOW(3)-1:R=WINDOW(2)-1
  84. CALL INSETRECT(T,44,44)
  85. CALL OFFSETRECT(T,1,1)
  86. CALL FRAMERECT(T)
  87. CALL OFFSETRECT(T,-1,-1)
  88. CALL ERASERECT(T)
  89. CALL FRAMERECT(T)
  90. CALL INSETRECT(T,-6,-6)
  91. T=B-7
  92. CALL OFFSETRECT(T,1,1)
  93. CALL FRAMERECT(T)
  94. CALL OFFSETRECT(T,-1,-1)
  95. CALL ERASERECT(T)
  96. CALL FRAMERECT(T)
  97. RETURN
  98.